<?php
/*
 * Created by aOmMiez
 * User: aOmMiez
 * Date: 1/4/13 AD
 * Time: 3:05 PM
 * Powered By Pla two fusion Co., Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License. You may obtain
 * a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 *
 */


class Platwo {

    /**
     * Version.
     */
    const VERSION = '1.0.0';

    /*
     * Server API
     */

    protected $server = "115.178.63.161";

    public function __construct() {

    }

    /*
     * ApiCall file get contents
     */

    public function apiCall ($link) {
        $result = file_get_contents($link);
        return $result;
    }

    /*
     * Regster Function
     */

    public function registerWithUsername ($username,$password,$email){
        $link = "http://".$this->server."/api/registerWithUsername?username=".$username."&password=".$password."&email=".$email;
        return $this->apiCall($link);
    }

    /*
     * Login Function
     */

    public function loginWithUsername($username,$password) {
        $link = "http://".$this->server."/api/loginWithUsernam?username=".$username."&password=".$password;
        return $this->apiCall($link);
    }

    /*
     * Get Like ID Result Function
     */

    public function getLike($id) {
        $link = "http://".$this->server."/api/getLike?id=".$id;
        return $this->apiCall($link);
    }

    /*
     * Get Photo Group Function
     */

    public function getphotoGroup($id) {
        $link = "http://".$this->server."/api/getphotoGroup?id=".$id;
        return $this->apiCall($link);
    }

    /*
     * Get Comment Function
     */

    public function getcommentGroup($id) {
        $link = "http://".$this->server."/api/getCommentGroup?id=".$id;
        return $this->apiCall($link);
    }

    /*
     * Get User Detail
     */

    public function getUser($id){
        $link = "http://".$this->server."/api/getUser?id=".$id;
        return $this->apiCall($link);
    }

    /*
     * Get User Facebook
     */

    public function getUserFacebook($id){
        $link = "http://".$this->server."/api/getUserFacebook?id=".$id;
        return $this->apiCall($link);
    }

    /*
     * Get Account Token Detail
     */

    public function getUserToken($id) {
        $link = "http://".$this->server."/api/getUserToken?id=".$id;
        return $this->apiCall($link);
    }

    /*
     * Get user album list
     */

    public function getUserAlbum($id) {
        $link = "http://".$this->server."/api/getUserAlbum?id=".$id;
        return $this->apiCall($link);
    }

    /*
     * get Site gallery
     */

    public function getSiteAlbum($id) {
        $link = "http://".$this->server."/api/getSiteGallery?id=".$id;
        return $this->apiCall($link);
    }

    /*
     * Get get Site Info
     */

    public function getSiteInfo($id) {
        $link = "http://".$this->server."/api/getSiteInfo?id=".$id;
        return $this->apiCall($link);
    }

    /*
     * Like
     */

    public function Like($id,$uid) {
        $link = "http://".$this->server."/api/Like?id=".$id."&uid=".$uid;
        return $this->apiCall($link);
    }

    /*
     * unlike
     */

    public function unLike($like_id,$uid) {
        $link = "http://".$this->server."/api/unLike?like_id=".$like_id."&uid=".$uid;
        return $this->apiCall($link);
    }

    /*
     * add Review Site
     */

    public function addReviewSite($uid,$place_id,$rate,$text) {
        $link = "http://".$this->server."/api/addReviewSite?uid=".$uid."&place_id=".$place_id."&rate=".$rate."&text=".$text;
        return $this->apiCall($link);
    }

    /*
     * useful yes
     */

    public function usefulYes($uid,$review_id) {
        $link = "http://".$this->server."/api/usefulYes?uid=".$uid."&review_id=".$review_id;
        return $this->apiCall($link);
    }

    /*
     * useful no
     */

    public function usefulNo($uid,$review_id) {
        $link = "http://".$this->server."/api/usefulNo?uid=".$uid."&review_id=".$review_id;
        return $this->apiCall($link);
    }

    /*
     * useful Deleting
     */

    public function usefulDel($uid,$useful_id) {
        $link = "http://".$this->server."/api/usefulDel?uid=".$uid."&useful_id=".$useful_id;
        return $this->apiCall($link);
    }

    /*
     * Get Review Site
     */

    public function getReview($place_id,$uid = null) {
        if ( $uid == null) {
            $link = "http://".$this->server."/api/getReview?place_id=".$place_id;
        } else {
            $link = "http://".$this->server."/api/getReview?uid=".$uid."&place_id=".$place_id;
        }
        return $this->apiCall($link);
    }

    /*
     * Add Tab Site
     */

    public function AddTabSite($place_id,$uid,$name,$type) {
        $link = "http://".$this->server."/api/AddTabSite?uid=".$uid."&place_id=".$place_id."&name=".$name."&type=".$type;
        return $this->apiCall($link);
    }

    /*
     * Edit Tab Site
     */

    public function EditTabSite($place_id,$uid,$name,$type,$tabid) {
        $link = "http://".$this->server."/api/EditTabSite?uid=".$uid."&place_id=".$place_id."&name=".$name."&type=".$type."&tabid=".$tabid;
        return $this->apiCall($link);
    }

    /*
     * Del Tab Site
     */

    public function DelTabSite($tabid,$place_id,$uid) {
        $link = "http://".$this->server."/api/DelTabSite?uid=".$uid."&place_id=".$place_id."&tabid=".$tabid;
        return $this->apiCall($link);
    }

    /*
     * Get Tab Site
     */

    public function getTabSite($place_id) {
            $link = "http://".$this->server."/api/getTabSite?place_id=".$place_id;
            return $this->apiCall($link);
    }
}
